﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Campus.Main.Basic.InsertValues;
using Campus.Main.Basic.Settings;
using cpmntctrl;
using dbcntn;

namespace Campus.Main.Basic
{
    public partial class ParentHandicapForm : StudentHandicapForm
    {
        public ParentHandicapForm()
        {
            InitializeComponent();
            Initialize();
        }

        public override sealed void Initialize()
        {
            aToDb.AddItemDBGridView(dataGridView1,Query.ParentHandicap);
            ControlComponent.UnVisibleCells(dataGridView1,0); 
        }

        protected override void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Length>0&&textBox2.Text.Length>0)
            {
                string desc = textBox1.Text.Trim(',', '-');
                string ball = textBox2.Text.Trim();
                aToDb.InsertIntoTable("parenthandicap","ball","description",Int32.Parse(ball),desc);
                ControlComponent.Clear(textBox1,textBox2);
                Initialize();
            }
            else
            {
                ShowMessage.ShowWarningMessage(textBox1,textBox2);
            }
        }

        protected override void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            ControlComponent.AddToList(data,dataGridView1,e,0,1,2);
            ParentHandicap f=new ParentHandicap(data);
            f.FormClosed += Bind;
            f.ShowDialog();
        }
    }
}
